package com.cakeclient.clientsoap.contract;


import org.ksoap2.serialization.SoapObject;

public class SimpleClient extends ContractObject {
    public int id;
    public String name;
    public String firstname;
    public int isMale;
    public String deviceID;
    public String phoneNumber;
    public String LVLigne1;
    public String LVLigne2;
    public String LVPostalCode;
    public String LVCity;
    public String LVCountry;


    public SimpleClient() {

    }

    public SimpleClient(com.cakeclient.Model.Client client) {
        if (client.getRemoteID() != null)
            id = Integer.valueOf(client.getRemoteID().toString());
        name = client.getName();
        firstname = client.getFirstName();
        isMale = (client.getSex() == com.cakeclient.Model.Gender.MALE) ? 1 : 0;
        deviceID = client.getDeviceID();
        phoneNumber = client.getPhoneNumber();
        if (client.getLivingPlace() != null && client.getLivingPlace().getAddress() != null) {
            LVLigne1 = client.getLivingPlace().getAddress().getLine1();
            LVLigne2 = client.getLivingPlace().getAddress().getLine2();
            LVPostalCode = client.getLivingPlace().getAddress().getPostalCode();
            LVCity = client.getLivingPlace().getAddress().getCity();
            LVCountry = client.getLivingPlace().getAddress().getCountry();
        }
    }

    @Override
    public void fill(SoapObject soapObject) {

    }
    /*
private Client toClient() {
 Client client = new Client();
 client.id = id;
 client.firstname = firstname;
 client.name = name;
 client.isMale = isMale;
 client.deviceID = deviceID;
 client.phoneNumber = phoneNumber;
 client.livingPlace = new Address();
 client.livingPlace.ligne1 = LVLigne1;
 client.livingPlace.ligne2 = LVLigne2;
 client.livingPlace.postalCode = Integer.parseInt(LVPostalCode);
 client.livingPlace.city = LVCity;
 client.livingPlace.country = LVCountry;

 return client;
}       */
}
